/**
 * Project: topdt-jbpm
 * Copyright 2013  Top Digital Technology  Co. Ltd.
 * All right reserved.
 */
package com.topdt.jbpm.form;

import java.util.ArrayList;
import java.util.List;

import com.topdt.jbpm.form.query.FieldType;

/**
 * 建立日期 : 2013-5-29 下午8:44:33<br>
 * 作者 : balance<br>
 * 模块 : 表单<br>
 * 描述 : 表单字段类型定义<br>
 * 修改历史: 序号 日期 修改人 修改原因 <br>
 * 1 <br>
 * 2 <br>
 */
public class FieldTypeDefin {
	private static final String[][] FIELDTYPES = new String[][] { { "text", "单行文本","none" },{ "textarea", "多行文本","none" }, { "number", "数字","none" },
		{ "email", "邮箱","none" }, { "date", "日期","none" }, { "datetime", "日期时间","none" }, { "time", "时间","none" }, { "mobile", "手机号","none" },
		{"phone","电话号码","none"},{"tree","树状","tree"},{"select","下拉菜单","more"},{"radio","单选框","more"},{"checkbox","复选框","more"},{"richTextEditer","富文本框","none"},{"url","URL","none"},{"systemVar","系统变量","system"}};

	public static String[][] getFieldTypes(){
		return FIELDTYPES;
	}
	public static List<FieldType> listFieldType(){
		List<FieldType> list = new ArrayList<FieldType>();
		for(String[] type : FIELDTYPES){
			FieldType fieldType = new FieldType();
			fieldType.setKey(type[0]);
			fieldType.setName(type[1]);
			fieldType.setParam(type[2]);
			list.add(fieldType);
		}
		return list;
	}
	public static FieldType getFiledTypeByKey(String key){
		for(String[] type : FIELDTYPES){
			if(key.equals(type[0])){
				FieldType fieldType = new FieldType();
				fieldType.setKey(type[0]);
				fieldType.setName(type[1]);
				fieldType.setParam(type[2]);
				return fieldType;
			}
		}
		return null;
	} 
}
